#include <pcap.h>
#include <assert.h>

#include "socket_init.h"
#include "log.h"

int socket_init(u_int16_t port,u_int32_t server_ip,struct sockaddr_in *addr)
{
	int s;
        s=socket(AF_INET,SOCK_DGRAM,0);
        //next is init the sockaddr_in of server

        /* 填写sockaddr_in*/
        bzero(addr,sizeof(struct sockaddr_in));

        addr->sin_family = AF_INET;
        addr->sin_port = htons(port);
        addr->sin_addr.s_addr = server_ip;
        return s;
}
